package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.CustomerTagDataMapper;
import com.ruoyi.factorydata.domain.CustomerTagData;
import com.ruoyi.factorydata.service.ICustomerTagDataService;

/**
 * 客户标签数据Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-03
 */
@Service
public class CustomerTagDataServiceImpl extends ServiceImpl<CustomerTagDataMapper, CustomerTagData> implements ICustomerTagDataService {
    @Autowired
    private CustomerTagDataMapper customerTagDataMapper;

    /**
     * 查询客户标签数据
     *
     * @param id 客户标签数据主键
     * @return 客户标签数据
     */
    @Override
    public CustomerTagData selectCustomerTagDataById(Long id) {
        return customerTagDataMapper.selectCustomerTagDataById(id);
    }

    /**
     * 查询客户标签数据列表
     *
     * @param customerTagData 客户标签数据
     * @return 客户标签数据
     */
    @Override
    public List<CustomerTagData> selectCustomerTagDataList(CustomerTagData customerTagData) {
        return customerTagDataMapper.selectCustomerTagDataList(customerTagData);
    }

    /**
     * 新增客户标签数据
     *
     * @param customerTagData 客户标签数据
     * @return 结果
     */
    @Override
    public int insertCustomerTagData(CustomerTagData customerTagData) {
                customerTagData.setCreateTime(DateUtils.getNowDate());
            return customerTagDataMapper.insertCustomerTagData(customerTagData);
    }

    /**
     * 修改客户标签数据
     *
     * @param customerTagData 客户标签数据
     * @return 结果
     */
    @Override
    public int updateCustomerTagData(CustomerTagData customerTagData) {
                customerTagData.setUpdateTime(DateUtils.getNowDate());
        return customerTagDataMapper.updateCustomerTagData(customerTagData);
    }

    /**
     * 批量删除客户标签数据
     *
     * @param ids 需要删除的客户标签数据主键
     * @return 结果
     */
    @Override
    public int deleteCustomerTagDataByIds(Long[] ids) {
        int i = customerTagDataMapper.deleteBatchIds(Arrays.stream(ids).collect(Collectors.toList()));
        return i;
    }

    /**
     * 删除客户标签数据信息
     *
     * @param id 客户标签数据主键
     * @return 结果
     */
    @Override
    public int deleteCustomerTagDataById(Long id) {
        return customerTagDataMapper.deleteCustomerTagDataById(id);
    }
}